@import "../../variables";

.network-dropdown {
  transition: background-color 150ms ease-in-out;
  height: 3rem;
  font-size: .8125rem;
  border-left: 1px solid rgba($white, .05);
  width: 15rem;

  &__status {
    flex: 0 0 auto;
    width: 1.25rem;
    height: 1.25rem;
    margin: 1.25rem 1rem;
    background-image: url("../../assets/icons/connectivity-best.svg");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
  }

  &__caret {
    flex: 0 0 auto;
    width: .5rem;
    height: .5rem;
    margin: 1.625rem 1rem;
    background-image: url("../../assets/icons/caret-down.svg");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
  }

  .dropdown {
    &__items {
      @extend %column-nowrap;
      background-color: mix($regal-blue, $black, 20);
      border-bottom-left-radius: 2px;
      border-bottom-right-radius: 2px;
      box-shadow: 0 4px 8px 0 rgba($black, .5);
    }

    &__item {
      @extend %row-nowrap;
      text-align: right;
      transition:
              background-color 150ms ease-in-out,
              color 150ms ease-in-out;
      white-space: nowrap;
      color: rgba($white, .5);
      padding: 1rem 1.5rem;

      &:hover {
        color: rgba($white, .8);
      }
    }
  }
}

.dropdown {
  .network-dropdown {
    &__selected-item {
      @extend %clickable;
      @extend %row-nowrap;
      align-items: center;
      justify-content: center;
      height: 100%;
      z-index: 4000;
      user-select: none;

      &__label {
        @extend %ellipsify;
        flex: 1 1 auto;
        width: 0;
        color: rgba($white, .8);
        margin-right: .75rem;
      }

      &__content {
        @extend %column-nowrap;
        justify-content: center;
        align-items: center;
        flex: 0 0 auto;
        margin: 0 .5rem;
      }
    }

    &__latency,
    &__sync-status {
      width: 2.5rem;
      text-align: center;
      font-weight: 400;
      font-size: 0.6875rem;
      padding: .1875rem .5rem;
      border-radius: .25rem;
    }

    &__latency {
      color: $white;
      margin-top: .25rem;

      &--fast {
        color: $shamrock-green;
      }

      &--normal {
        color: $texas-rose-orange;
      }

      &--slow {
        color: $persimmon-red;
      }
    }

    &__sync-status {
      color: $white;
      position: relative;
      overflow: hidden;

      &__percentage {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
      }

      &--synced {
        color: $shamrock-green;
        border: 1px solid rgba($shamrock-green, .35);

        .network-dropdown__sync-status__percentage {
          background-color: rgba($shamrock-green, .15);
        }
      }

      &--syncing {
        color: $texas-rose-orange;
        border: 1px solid rgba($texas-rose-orange, .35);
        .network-dropdown__sync-status__percentage {
          @extend %loading-placeholder;
          overflow: hidden;
          background-color: rgba($texas-rose-orange, .15);
          border-right: 1px solid rgba($texas-rose-orange, .1);
        }
      }


    }

    &__item {
      height: 3rem;
      padding-left: 1rem;
    }
  }


  &--opened {
    background-color: rgba($black, .15);
    .network-dropdown {
      &__caret {
        background-image: url("../../assets/icons/caret-up.svg");
      }
    }
  }
}